import getCinemaListSerive from '../services/maizuo'

export default {

    namespace: 'maizuo',

    state: {
        isShow: true,
        list: []
    },
    reducers: {
        hide(state, action) {
            return { ...state, isShow: false };
        },
        show(state, action) {
            return { ...state, isShow: true };
        },
        cinemaPlay(state, { payload }) {
            return { ...state, list: payload };
        }
    },
    //同步
    subscriptions: {
        setup({ dispatch, history }) {  // eslint-disable-line
        },
    },
    //异步
    effects: {
        *getCinemaList({ payload }, { call, put }) {
            const res = yield call(getCinemaListSerive);
            console.log(res)
            yield put({
                type: 'cinemaPlay',
                payload: res.data.data
            })
        },
    },
}